class Stack:
    def __init__(self):
        self.stack = []

    def push(self, element):
        self.stack.append(element)

    def pop(self):
        self.stack.pop()

    def is_empty(self):
        return len(self.stack) == 0

    def get_top(self):
        if len(self.stack) == 0:
            return None
        return self.stack[-1]


def match(s: str):
    stack = Stack()
    data_dict = {'}': '{', ']': '[', ')': '('}
    for i in s:
        if i in ['{', '[', '(']:
            stack.push(i)
        else:
            data = stack.get_top()
            if data_dict.get(data) == i:
                data.pop()
            else:
                if stack.is_empty():
                    return False
                elif stack.get_top() == data_dict[i]:
                    stack.pop()
                else:
                    return False
    if stack.is_empty():
        return True
    else:
        return False


data = "[]"
res = match(data)
print(res)
